//
//  LGSmokeRecordHeader.m
//  XieHeHeartDisease
//
//  Created by 1234 on 2024/1/31.
//

#import "LGSmokeRecordHeader.h"
#define dateWidth    viewPix(87)
#define itemWidth    (Screen_W-viewPix(32)-dateWidth)/2.0
@interface LGSmokeRecordHeader()
/**   */
@property (nonatomic , strong)UIView *baseView;

@end

@implementation LGSmokeRecordHeader

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.clipsToBounds = YES;
        self.backgroundColor = [UIColor clearColor];
        [self addSubview:self.baseView];
        [self createLineView];
    }
    return self;
}


-(UIView *)baseView{
    if(!_baseView){
        _baseView = [UIView shadowViewWithColor:@"#B3C5D9" offset:CGSizeMake(0, 2) opacity:0.15 radius:10];
        _baseView.frame = CGRectMake(viewPix(16), viewPix(5), Screen_W-viewPix(32), viewPix(55));
        _baseView.backgroundColor = [UIColor whiteColor];
    }
    return _baseView;
}

-(void)createLineView{
    NSArray *itemArray = @[@"戒烟计划",@"完成情况"];
    for (NSInteger i=0; i<itemArray.count; i++) {
        UIView *lineView = [[UIView alloc]initWithFrame:CGRectMake(dateWidth+itemWidth*i, 0, 1, viewPix(36))];
        lineView.backgroundColor = [UIColor colorWithString:@"#F2F2F2"];
        [self.baseView addSubview:lineView];
        UILabel *itemLabel = [UILabel lableWithText:itemArray[i] colorString:@"#333333" textFont:LGFont(12) textAlignment:NSTextAlignmentCenter lines:1];
        itemLabel.frame = CGRectMake(dateWidth+itemWidth*i, 0, itemWidth-1, viewPix(36));
        [self.baseView addSubview:itemLabel];
    }
    
    UILabel *sleepLabel = [UILabel lableWithText:@"日期" colorString:@"#333333" textFont:LGFont(12) textAlignment:NSTextAlignmentCenter lines:1];
    sleepLabel.frame = CGRectMake(0, 0, dateWidth, viewPix(36));
    [self.baseView addSubview:sleepLabel];
}


@end
